﻿using blackhouse.BlackApart.Business.Apartments;
using blackhouse.WebNemo.Business.Groups;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using blackhouse.WebNemo.Web;

namespace blackhouse.BlackApart.WebNemo {
    public class NemoApartmentPhoto : GroupRecord, IApartmentPhoto {

        #region Properties

        public int PhotoId {
            get { return this.RecordId; }
        }

        public string PhotoName {
            get { return this.GetString("zdjecie"); }
            set { throw new NotImplementedException(); }
        }

        public string Category {
            get {
                GroupRecord gr = this.GetRecord("kategoria_zdjecia");
                if (gr != null)
                    return gr.GetString("nazwa_kategorii");
                else
                    return String.Empty;
            }
            set { throw new NotImplementedException(); }
        }

        public string Description {
            get { return this.GetString("tytul_zdjecia"); }
            set { throw new NotImplementedException(); }
        }

        public int Sort {
            get { return 1; }
            set { throw new NotImplementedException(); }
        }

        #endregion

        #region Constructors

        public NemoApartmentPhoto() : base("ZDJECIA_APARTAMENTOW", 0) { }
        public NemoApartmentPhoto(int photoId) : base("ZDJECIA_APARTAMENTOW", photoId) { }
        public NemoApartmentPhoto(IGroup group, IGroupRecord record) : base(group, record) { }

        #endregion

        #region Methods

        public IApartmentPhoto[] GetApartmentPhotos(int apartmentId) {
            throw new NotImplementedException();
        }

        public IApartmentPhoto[] GetApartmentTypePhotos(int apartmentTypeId) {
            NemoApartmentType apartmentType = new NemoApartmentType(apartmentTypeId);
            return apartmentType.GetRecords<NemoApartmentPhoto>("pozostale_zdjecia").ToArray();
        }

        #endregion

        public string GetImageUrl(Size size) {
            return this.GetImageUrl("zdjecie", size);
        }

    }
}
